import { ShapeFlag } from '../src/flags'

export type vnode = {
  tag:keyof HTMLElementTagNameMap
  key?:number|string
  props:Partial<{
    id:string
    class:string
    style:string
    key:string
    onclick:Function
    [propName:string]:string|Function
  }>
  children:(string|vnode)[]
  shapeFlag?: ShapeFlag
}

export interface App {
  mount(rootContainer:string|HTMLElement):void
  use():void
  component():void
  directive(name:string, hooks:object):void
}

export type RenderFunction = ()=>vnode

export interface ComponentInstance {
  vnode:vnode
  type:{
    setup(props:object, context:SetupContext):object|RenderFunction|Promise<unknown>
    render():any
  }
  effect:unknown
  update:Function
  isMounted?:boolean
  props?:object
  attrs?:object
  slots?:object
  emit?():void
  proxy?:object
  data?:object
  setupReturnState?:object
  render?():unknown
  life:{
    bm:Function[]
    m:Function[]
    bu:Function[]
    u:Function[]
  }
  ctx?:object
  accessCache?:object
  appContext?:object
  el?:HTMLElement|null
}

export interface RendererOperation {
  insert():void
  remove():void
  querySelector():void
  createElement():void
}

export interface SetupContext {
  attrs:object
  emit():void
  slots:object
}

export interface DirectiveBinding {
  arg:any
  oldValue:any
  value:any
  modifiers:object
}

export interface CustomDirectiveOption {
  mounted?(el:HTMLElement, binding:DirectiveBinding):void


}